<template>
	<view>
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<template #top>
				<zy-title title="谁看过我">
					<template v-slot:title>
						<view class="zy-btn-yellow-sm zy-ml-sm">会员专享</view>
					</template>
				</zy-title>
			</template>
		
			<view class="zy-row zy-mv-lg zy-ph-lg" v-for="(item, index) in dataList" :key="index">
				<!-- 头像 -->
				<image class="zy-img-circle" :class="{'zy-blur': !vip}" :src="item.headPicUrl"></image>
				<view class="zy-column-center zy-flex zy-ml">
					<!-- 昵称，时间 -->
					<view class="zy-row-between">
						<view class="zy-row-between" :class="{'zy-blur': !vip}">
							<text class="zy-text-white-lg-bold">{{item.nick}}</text>
							<view class="zy-btn-yellow-sm zy-ml-sm">？？</view>
						</view>
						<view class="zy-text-whitegrey-sm-super">{{getTime(item.visTime)}}</view>
					</view>
					<!-- 信息：年龄，位置，星座；按钮 -->
					<view class="zy-row-between">
						<view class="zy-text-whitegrey" >95后 位置保密 双子座</view>
						<view class="zy-btn-main-sm-capsule zy-text-white-sm" @click="toUserInfo(item)">看看是谁</view>
					</view>
				</view>
			</view>
		</z-paging>
		
		<popup-vip ref="vip"></popup-vip>
	</view>
</template>

<script>
	import TimeUtil from '@/main/common/TimeUtil.js'
import CacheUtil from '../../common/CacheUtil';
import RouteUtil from '../../common/RouteUtil';
	export default {
		data() {
			return {
				dataList: [],
				vip:false
			};
		},
		onLoad() {
			this.vip = CacheUtil.getVip()
		},
		methods: {
			queryList(pageNo, pageSize) {
				const params = {
					pageNo: pageNo,
				}
				uni.$http.get("/api/visitor/visitorList", params)
					.then(res => {
						this.$refs.paging.complete(res.data.results);
					}).catch(res => {
						this.$refs.paging.complete(false);
					})
			},
			getTime(dateStr){
				return TimeUtil.stringToText(dateStr)
			},
			getInfo(item){
				
			},
			toUserInfo(item){
				if(this.vip){
					RouteUtil.toUserInfo(item.txCode)
				}else{
					this.$refs.vip.open(item.headPicUrl)
				}
				
			}
		}
	}
</script>

<style>

</style>
